package cursopoo.herramientas

import javax.swing.WindowConstants as WC

import groovy.swing.SwingBuilder
import java.awt.Color

class VentanaGrafica {
    private grafico = new PanelGrafico()

    private ventana = new SwingBuilder().frame(
            title: 'Curso POO',
            size: [300, 300],
            visible: false,
            defaultCloseOperation: WC.EXIT_ON_CLOSE) {
        panel(grafico, background: Color.WHITE)
    }

    def agregar(figura) {
        grafico.figuras.add figura
    }

    def mostrar() {
        ventana.setVisible(true)
    }
}
